package com.qfedu.lc.user.controller;


import com.qfedu.lc.common.vo.R;
import com.qfedu.lc.user.service.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/pay")
@RestController
public class PayCallBackController {

    @Autowired
    private WalletService walletService;

    /**
     * 支付宝 支付成功回调接口
     * @return
     */
    @GetMapping("/alipay/cb")
    public R aliPayCallBack(String out_trade_no){

        System.out.println("支付成功订单号 out_trade_no = " + out_trade_no);


        if (out_trade_no.startsWith("w")){ // 账户充值

            return   walletService.rechargeByZhiFuBaoCallBack(out_trade_no);
        }else if (out_trade_no.startsWith("v")){ // vip 订单直接使用vip 购买

        }

        return R.fail("支付失败");
    }

}
